package com.tnl.app.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.tnl.app.entity.Interview;
import com.tnl.app.entity.InterviewRecord;
import com.tnl.base.BaseDAO;

@Repository
public class InterViewRecordDAO {
	
	private static final String SQL_GET_ALL = "select * from tb_interview_record where interviewId=? order by createTime desc";
	private static final String SQL_INSERT = " insert into tb_interview_record (interviewId, itype,status,remark,createby,createTime)"
			+ " values(?,?,?,?,?,?)";
	
	public static enum Status {
		wait, start, processing, completed, rejected,accepted,cancelled
	}
	
	public List<InterviewRecord> getALL(int id) {
		return BaseDAO.queryForList(InterviewRecord.class, SQL_GET_ALL,id);
	}

	private static final String SQL_GET_RECOMMENDID="select * from tb_interview  where recommendId=? order by createTime desc";
	public Interview getRecommendIdByInfo(int recommendId){
		return BaseDAO.queryForObject(Interview.class, SQL_GET_RECOMMENDID, recommendId);
	}
	
	public Long save(InterviewRecord interviewRecord) {
		return BaseDAO.save( SQL_INSERT, interviewRecord.getInterviewId(), interviewRecord.getItype(), 
				interviewRecord.getStatus(),interviewRecord.getRemark(),interviewRecord.getCreateBy(),interviewRecord.getCreateTime());
	}
	
}
